package com.zretc.entity;

/**
 * @author: bLUeSuMMerDreamer
 * @createTime: 2020-08-26 14:41
 */
public class OrderDetail {
    private Integer orderDetailId;
    private Order order;

    private Product product;
    private Integer count;
    private Double totalPrice;
    private Integer status;

    @Override
    public String toString() {
        return "OrderDetail{" +
                "orderDetailId='" + orderDetailId + '\'' +
                ", order=" + order +
                ", product=" + product +
                ", count=" + count +
                ", totalPrice=" + totalPrice +
                ", status=" + status +
                '}';
    }

    public Integer getOrderDetailId() {
        return orderDetailId;
    }

    public void setOrderDetailId(Integer orderDetailId) {
        this.orderDetailId = orderDetailId;
    }

    public Order getOrder() {
        return order;
    }

    public void setOrder(Order order) {
        this.order = order;
    }

    public Product getProduct() {
        return product;
    }

    public void setProduct(Product product) {
        this.product = product;
        if (this.count != null) {
            this.totalPrice = this.count * this.product.getProductPrice() * 1.0;
        }
    }

    public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }

    public Double getTotalPrice() {
        return totalPrice;
    }

    public void setTotalPrice(Double totalPrice) {
        this.totalPrice = totalPrice;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public OrderDetail(Integer orderDetailId, Order order, Product product, Integer count, Integer status) {
        this.orderDetailId = orderDetailId;
        this.order = order;
        this.product = product;
        this.count = count;
        if (this.count != null && product != null) {
            this.totalPrice = this.count * this.product.getProductPrice() * 1.0;
        }
        this.status = status;
    }

    public OrderDetail() {
    }
}
